<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        li {
            list-style: none;
        }
        .big {
            width: 600px;
            margin: 100px auto;
            border: 1px solid #000;
            padding: 20px;
        }
        .txt {
            width: 450px;
            height: 160px;
            outline: 8px ridge rgba(170, 50, 220, .1);
            border-radius: 2rem;
            resize: none;
            padding: 10px;
        }
        ul {
            width: 450px;
            padding-left: 70px;
        }
        ul li {
            line-height: 25px;
            border-bottom: 1px dashed #cccccc;
            display:none;
        }
        ul li a {
            color: black;
            font-size: 12px;
            float: right;
        }
    </style>
    <script src="../jQuery/jquery.min.js"></script>
    <script>
        $(function() {
            $(".btn").on("click", function() {
                var li = $("<li></li>");
                li.html($(".txt").val() + "<a href='javascript:;'>删除</a>");
                $("ul").prepend(li);
                li.slideDown();
                $("textarea").val("");
            });
            // 此处要为on绑定，因为li是后来加入的，需要动态绑定
            $("ul").on("click", "a", function() {
                $(this).parent().slideUp(function() {
                    $(this).remove();
                });
            })
        });
    </script>
</head>
<body>
    <div class="big">
        <span>微博发布</span>
        <textarea  class="txt" cols="30" rows="10"></textarea>
        <button class="btn">发布</button>
        <ul>
        </ul>
    </div>
</body>
</html>